<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            width: 400px;
            height: 40px;
            line-height: 40px;
            border: 1px tomato solid;
        }
    </style>
</head>

<body>
    <p>测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本测试长文本</p>
</body>

</html>